package uit.bus;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class OrderTTTAddapter extends ArrayAdapter<OrderTTT> {
	public ArrayList<OrderTTT> items;
	public Context myContext;

	public OrderTTTAddapter(Context context, int textViewResourceId,
			ArrayList<uit.bus.OrderTTT> items) {
		super(context, textViewResourceId, items);
		// TODO Auto-generated constructor stub
		this.items = items;
		myContext = context;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		View v = convertView;
		if (v == null) {
			LayoutInflater vi = (LayoutInflater) getContext().getSystemService(
					Context.LAYOUT_INFLATER_SERVICE);
			v = vi.inflate(R.layout.row_thongtintuyen, null);
		}
		OrderTTT o = items.get(position);
		if (o != null) {
			TextView matuyen = (TextView) v.findViewById(R.id.matuyen);
			TextView tentuyen = (TextView) v.findViewById(R.id.tentuyen);
			if (matuyen != null) {
				matuyen.setText("Mã Tuyến : " + o.getMatuyen());
			}
			if (tentuyen != null) {
				tentuyen.setText(o.getTentuyen());
			}
		}
		return v;
	}
}
